<?php /*a:3:{s:67:"D:\PhpStorm\PhpStormProject\short_link\view\admin\config\index.html";i:1757171021;s:68:"D:\PhpStorm\PhpStormProject\short_link\view\admin\common\header.html";i:1753878054;s:68:"D:\PhpStorm\PhpStormProject\short_link\view\admin\common\footer.html";i:1753878054;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
    <link rel="stylesheet" href="/static/admin/css/reset.css"/>
    <link rel="stylesheet" href="/static/admin/css/other/console1.css"/>
    <link rel="stylesheet" href="/static/component/layui/inputTag.css">
    <!-- 主 题 更 换 -->
    <style id="pearadmin-bg-color"></style>
</head>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script src="/static/admin/js/common.js"></script>
<script src="/static/component/layui/iconPicker.js"></script>

<body class="pear-container">
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <form class="layui-form edit-form" method="post" action="">
                <div class="layui-tab layui-tab-brief" lay-filter="TabBrief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基础设置</li>
                        <li>链接设置</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    网站标题
                                </label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="title"
                                           value="<?php echo isset($data['title']) ? htmlentities($data['title']) : ''; ?>" type="text"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    网站LOGO
                                </label>
                                <div class="layui-input-block">
                                    <button type="button" class="pear-btn pear-btn-primary pear-btn-sm upload-image" id="logo"><i class="fa fa-image"></i>上传图片</button><div class="upload-image" style="display:inline-flex;flex-wrap: wrap;" id="logosid"><?php $__LIST__ = $data['logo']??[] ? $data['logo']??[] : [] ;$__LIST__ = is_array($__LIST__) ? $__LIST__ : [$__LIST__]; if(is_array($__LIST__) || $__LIST__ instanceof \think\Collection || $__LIST__ instanceof \think\Paginator): $i = 0; $__LIST__ = $__LIST__;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><div class="updiv" style="position: relative;margin-left: 5px;"><input type="hidden" name="logo" value="<?php echo htmlentities($val); ?>" /><a href="<?php echo htmlentities($val); ?>" target="_blank"><img src="<?php echo htmlentities($val); ?>" alt="<?php echo htmlentities($val); ?>" class="upload-image"></a><img width="15px" src="/static/admin/images/x.png" class="pos_close" style="position: absolute;right: 0px;top: 0px;" onclick="pos_close(this)"/></div><?php endforeach; endif; else: echo "" ;endif; ?></div><script language="JavaScript" type="text/javascript" src="/static/admin/js/jquery.min.js"></script><script language="JavaScript" type="text/javascript" src="/static/component/layui/sortable.js"></script><script type="text/javascript">layui.use(['upload','common'],function(){var upload = layui.upload;var common = layui.common;upload.render({elem: '#logo',url: '<?php echo htmlentities(app('request')->root()); ?>/index/upload?type=image&path=config&save=0&local=',accept:'images',exts:'jpg|png|jpeg|gif|bmp|svg|php',size:'5120',field:'imageFile',multiple:false,done: function(res){if(res.code==0){$("#logosid").html('<div class="updiv" style="position: relative;margin-left: 5px;"><input type="hidden" name="logo" value="'+ res.data.src +'" /><a href="'+ res.data.src +'" target="_blank"><img src="'+ res.data.src +'" alt="'+ res.data.src +'" class="upload-image"></a><img width="15px" src="/static/admin/images/x.png" class="pos_close" style="position: absolute;right: 0px;top: 0px;" onclick="pos_close(this)"/></div>');}layer.msg(res.msg);},error: function(res){console.log(res);layer.msg('上传失败！');}});$("#cropper_logo").on('click', function () {cropperImage('');});function cropperImage(image) {layer.open({type: 2,title: '上传图片',shade: 0.1,area: common.screenBig(),content:'http://admin.short.link:7777/admin.php/Index/imageCropper.html?path=config&save=0&width=0&height=0&image='+image,btn: ['确定', '取消'],yes: function (index, layero) {window['layui-layer-iframe' + index].submitForm().then(function (result) {layer.close(index);$("#logosid").html('<div class="updiv" style="position: relative;margin-left: 5px;"><input type="hidden" name="logo" value="'+ result.src +'" /><a href="'+ result.src +'" target="_blank"><img src="'+ result.src +'" alt="'+ result.src +'" class="upload-image"></a><img width="15px" src="/static/admin/images/x.png" class="pos_close" style="position: absolute;right: 0px;top: 0px;" onclick="pos_close(this)"/></div>');});}});}});var pos_close = function(obj){$(obj).parent().remove();};new Sortable(document.getElementById('logosid'), {animation: 150,ghostClass: 'updiv',});</script>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    登录验证码
                                </label>
                                <div class="layui-input-block">
                                    <?php if($data['login_captcha'] == 1): ?>
                                    <input type="radio" name="login_captcha" value="1" title="开启" checked>
                                    <input type="radio" name="login_captcha" value="0" title="关闭">
                                    <?php else: ?>
                                    <input type="radio" name="login_captcha" value="1" title="开启">
                                    <input type="radio" name="login_captcha" value="0" title="关闭" checked>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-form-item">
                                <label class="layui-form-label">生成位数(位)</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="code_number"
                                           value="<?php echo isset($data['code_number']) ? htmlentities($data['code_number']) : '6'; ?>" type="text"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">链接时长(天)</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="expire_time"
                                           value="<?php echo isset($data['expire_time']) ? htmlentities($data['expire_time']) : '999'; ?>" type="text"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">API生成</label>
                                <div class="layui-input-block">
                                    <?php if($data['api_generate']??0): ?>
                                    <input type="radio" name="api_generate" value="1" title="开启" checked>
                                    <input type="radio" name="api_generate" value="0" title="关闭">
                                    <?php else: ?>
                                    <input type="radio" name="api_generate" value="1" title="开启">
                                    <input type="radio" name="api_generate" value="0" title="关闭" checked>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">生成密码</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" placeholder="留空则不验证密码"
                                           name="generate_pwd" value="<?php echo isset($data['generate_pwd']) ? htmlentities($data['generate_pwd']) : ''; ?>" type="text"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-input-block" style="min-height: 80px;">
                    <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit=""
                            lay-filter="save">
                        <i class="layui-icon layui-icon-ok"></i>
                        提交
                    </button>
                    <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                        <i class="layui-icon layui-icon-refresh"></i>
                        重置
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(save)', function (data) {
            $.ajax({
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function (res) {
                    //判断有没有权限
                    if (res && res.code == 999) {
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 2000,
                        })
                        return false;
                    } else if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                }
            })
            return false;
        });


        form.on('radio(type)', function (data) {
            if (data.value == 1) {
                $("#oss").hide();
                $("#qiniu").hide();
            }
            if (data.value == 2) {
                $("#oss").show();
                $("#qiniu").hide();
            }
            if (data.value == 3) {
                $("#qiniu").show();
                $("#oss").hide();
            }
        });
    })
</script>
</body>
</html>
